class Solution
{
public:
    int minOperations(string s)
    {
        bool flag = true;
        int count1 = 0;
        int count2 = 0;
        for (char c : s)
        {
            if (c == '0')
            {
                count1 += flag;
                count2 += !flag;
            }
            else
            {
                count1 += !flag;
                count2 += flag;
            }
            flag = !flag;
        }
        return min(count1, count2);
    }
};